package org.example.code.service;

import org.example.code.service.impl.CodeFeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @description: CodeContorller
 * @author: e
 * @createDate: 2021/5/30
 */
@FeignClient(value = "service-code",
        fallback = CodeFeignServiceFallback.class,
        path = "/code")
public interface CodeFeignService {

    /***
     * 生成验证码并发送到对应邮箱，成功true，失败false
     **/
    @GetMapping("/create/{email}")
    boolean create(@PathVariable("email") String email);


    /***
     * 校验验证码是否正确 0 正确，1错误，2 超时
     **/
    @GetMapping("/validate/{email}/{code}")
    int validate(@PathVariable("email") String email,
                 @PathVariable("code") String code);

    /***
     * 更新状态
     **/
    @GetMapping("/update/status/{code}")
    public boolean updateStatus(@PathVariable("code") String code);
}
